package zozopo.warehouse.flow;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import zozopo.background.operator.operations.OperatorTB;
import zozopo.flow.comm.Flow;
import zozopo.user.operations.UserOS;
import zozopo.user.operations.UserTB;
import zozopo.warehouse.operations.AftersaleserviceOS;
import zozopo.warehouse.operations.AftersaleserviceTB;
import zozopo.warehouse.operations.ReceiptOS;
import zozopo.warehouse.operations.ReceiptTB;
import zozopo.warehouse.operations.ReceiptlistOS;
import zozopo.warehouse.operations.ReceiptlistTB;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class PreConfirmAftersaleserviceShipFlowAction extends ActionSupport implements Action,SessionAware{
	//传入参数
	private String flowCode = "";
	private String kind ="";
	private int kindid ;

	//传出参数
	private AftersaleserviceTB aftersaleservice;
	
	private Map<Object, Object> session;
	public void setSession(Map arg0) {
		// TODO Auto-generated method stub
		session = arg0;
	}
	public String execute(){
		
	
		
		String forward = SUCCESS;
		
		Flow flow = new Flow();
		AftersaleserviceOS aftersaleserviceOS = new AftersaleserviceOS(flow.getConn());
		aftersaleservice = aftersaleserviceOS.get(kindid);
		
		if(!flow.isNextCode(kind, kindid, flowCode)){  // 如果下次的流程值不同就跳出本次处理。 预防多人输入时发生错误。
			flow.releaseConnection();
			return ERROR;
		}//*/
		flow.releaseConnection();
		
		
		return forward;
		
	}
	
	public void validate() {
		//权限处理
		OperatorTB operator = (OperatorTB)session.get("operatorInfo"); 
	
		if(operator == null){
			addFieldError("errormessage",getText("operator.timeoutornotlogin"));
			return ; 
		} 
		
		
	}
	
	public String getFlowCode() {
		return flowCode;
	}
	public void setFlowCode(String flowCode) {
		this.flowCode = flowCode;
	}
	public String getKind() {
		return kind; 
	}
	public void setKind(String kind) {
		this.kind = kind;
	}
	public int getKindid() {
		return kindid;
	}
	public void setKindid(int kindid) {
		this.kindid = kindid;
	}
	public AftersaleserviceTB getAftersaleservice() {
		return aftersaleservice;
	}
	public void setAftersaleservice(AftersaleserviceTB aftersaleservice) {
		this.aftersaleservice = aftersaleservice;
	}
	

}
